﻿namespace Acl.Messages;

/// <summary>
/// 分布式消息管理器
/// </summary>
public interface IDistributionMessageHandleManagement:IAsyncDisposable
{
    /// <summary>
    /// 订阅处理器数量
    /// </summary>
    int HandlerCount { get; }

    /// <summary>
    /// 注册处理器
    /// </summary>
    /// <param name="handler"></param>
    /// <returns></returns>

    Task AddHandler(IDistributionMessageHandlerBase handler);

    /// <summary>
    /// 注册通知处理器
    /// </summary>
    /// <typeparam name="TData"></typeparam>
    /// <param name="handler"></param>
    /// <returns></returns>
    Task AddNotificationHandler<TData>(IDistributionNotificationHandler<TData> handler);

    /// <summary>
    /// 注册请求响应处理器
    /// </summary>
    /// <typeparam name="TData"></typeparam>
    /// <typeparam name="TResponse"></typeparam>
    /// <param name="handler"></param>
    /// <returns></returns>
    Task AddRequestHandler<TData, TResponse>(IDistributionRequestHandler<TData, TResponse> handler);

    /// <summary>
    /// 移除处理器
    /// </summary>
    /// <param name="handler"></param>
    /// <returns></returns>
    Task RemoveHandler(IDistributionMessageHandlerBase handler);
}